package reduce.fz.com.reduce.util.photo;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import java.util.ArrayList;
import java.util.List;

import reduce.fz.com.reduce.constant.PublishParams;
import reduce.fz.com.reduce.photo.PhotoWallActivity;

/**
 * Created by qingshengzheng on 15/11/9.
 */
public class PhotoSelect {

    private Context mContext;
    private Activity mActivity;
    private SelectParam selectParam;
    //拍照
    public final static int SELECT_PIC = 667;
    //截图
    public final static int CROP_PIC = 666;


    private PhotoSelect(Activity activity, SelectParam param) {
        this.mContext = activity.getBaseContext();
        this.mActivity = activity;
        this.selectParam = param;
    }

    public static PhotoSelect instance(Activity mActivity, SelectParam param) {
        PhotoSelect select = new PhotoSelect(mActivity, param);
        return select;
    }

    public void selectPhoto() {
        Intent intent = new Intent(mContext, PhotoWallActivity.class);
        intent.putExtra(PublishParams.MAX_SELECT_COUNT, 1);
        mActivity.startActivityForResult(intent, SELECT_PIC);
    }

    public ArrayList<String> getSelectPaths(Intent data) {
        ArrayList<String> selectPath = data.getStringArrayListExtra(PhotoWallActivity.IMAGE_SELECT_RESULT);
        return selectPath;

    }
}
